<h1><%=t(:available_worktimes)%></h1>
<div class="dictionaryDiv">
  <span>
    <%= t(:available_worktimes) %> <br />
    <%= t(:available_worktimes_places, {:count => (@place ? 1 : 0), 
                                        :place => (@place ? @place.name : "") }) %> <br />
    <%= t(:available_worktimes_specialities, {:count => (@speciality ? 1 : 0), 
                                        :speciality => (@speciality ? @speciality.name : "") }) %> <br />
    <%= t(:available_worktimes_doctors, {:count => (@doctor ? 1 : 0), 
                                        :doctor => (@doctor ? @doctor.name : "") }) %> <br />
  </span>
  
  <span id="newRecordLink">
    <%= link_to(t(:search_for_new_visit)+image_tag(ApplicationHelper::SEARCH_IMG), search_available_worktimes_path(@patient)) %>
  </span>

  <table class="dictionaryTable ui-collection" cellpadding="0" cellspacing="0">
    <thead>
      <tr>
	<% for day in @days %>
	<th style= <%= "width:" + (100/@days.count).to_s+ "%" %> > <%= day %> </th>
	<% end %>
      </tr>
    </thead>   
    <tr class="ui-collection-result">
      <% for day in @days %>
      <td> 
	<!-- Worktimes for -->
	<% for worktime in ApplicationHelper::available_worktimes(@place ? @place.id : nil, @speciality ? @speciality.id : nil, @doctor ? @doctor.id : nil, day) %>
	<table class="dictionaryTable ui-collection" cellpadding="0" cellspacing="0"> 	  
	  <% for w in worktime.not_reserved_hours(day) %>          
          <tr class="ui-collection-result"><td>
              <%= link_to worktime.doctor.name + " - " + worktime.format_day_minutes_range(w), 
	          new_patient_visit_reservation_path(@patient, :params => {:doctor_id => worktime.doctor_id, 
	      :date => day.to_date,
	      :since_minute => w[0],
	      :until_minute => w[1]}) %>
	  </td></tr>  
	  <% end %>
	</table>
	<% end %>
      </td>
      <% end %>      
    </tr>
  </table>
</div>


